const state = {
    login: localStorage.getItem('token') !== null
}
const mutations = {
    changeLogin(state, payload = {token: '', userid: ''}) {
        state.login = localStorage.getItem('token') !== null
        state.login = !state.login
        if (!state.login) {
            console.warn("缓存清除,解除登录")
            localStorage.removeItem('token')
            localStorage.removeItem('userid')
        } else {
            console.warn("已存入缓存,登录状态")
            localStorage.setItem('token', payload.token)
            localStorage.setItem('userid', payload.userid)
        }
    }
}
const actions = {}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}